package robocup.component.actions;

/**
 * A reconnect action, which can be used to re-establish a connection to the
 * server after a connection was resetted.
 */
public class ReconnectAction
    extends Action {

  /**
   * The teamname of the agent.
   */
  private String _teamName;

  /**
   * The number of the agent, which should, which should be controlled.
   */
  private int    _number;

  /**
   * Constrcutor of a reconnect action - causes the agent ro reconnect to the
   * server
   * 
   * @param teamName
   *          the teamname of the agent
   * @param number
   *          the <unum> of the agent
   */
  public ReconnectAction(
      final String teamName,
      final int number) {

    this._teamName = teamName;
    this._number = number;
  }

  /**
   * Returns the actions string representation:
   * 
   * @return (reconnect &lt;teamName&gt; &lt;number&gt;)<br>
   *         <br>
   */
  @Override
  public String toString() {

    final StringBuffer buf = new StringBuffer();
    buf.append("(reconnect ");
    buf.append(this._teamName);
    buf.append(" ");
    buf.append(this._number);
    buf.append(")");

    return buf.toString();
  }
}
